import com.sun.org.apache.xpath.internal.objects.XString;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Manager {
    private static  List<Student> list=new ArrayList<>();
    static Student student=new Student();
    static Scanner reader=new Scanner(System.in);
    public static void main(String[] args){
        list.add(new Student(1L,"aaa","boy",17 ));
        list.add(new Student(2L,"bbb","girl",17 ));
        list.add(new Student(3L,"ccc","boy",17 ));
        String option= reader.nextLine();
        switch(option){
            case"printall":
                printall();
                break;
            case"change":
                change();
                break;
            case"print":
                print();
                break;
            case"add":
                add();
                break;
        }
//        while(reader.hasNext()){
//            student.setName(reader.nextLine());
//            student.setStuID(reader.nextLong());
//            student.setAge(reader.nextInt());
//            student.setSex(reader.nextLine());
//
//        }
    }
    static void printall(){
        for(Student student:list){
            System.out.println(student.toString());
        }
    }
    static void print(){
        String name= reader.nextLine();
        for(int i=0;i< list.size();i++){
            if(name.equals(list.get(i).getName())){
                System.out.println(list.get(i).toString());
            }
        }
    }
    static void change(){
        String name= reader.nextLine();
        for(int i=0;i< list.size();i++){
            if(name.equals(list.get(i).getName())){
               String name1= reader.nextLine();
               String sex= reader.nextLine();
               Long ID= reader.nextLong();
               Integer age= reader.nextInt();
               list.get(i).setName(name1);
               list.get(i).setStuID(ID);
               list.get(i).setSex(sex);
               list.get(i).setAge(age);
               System.out.println(list.get(i).toString());
            }
        }
    }
    static void add(){
        student.setName(reader.nextLine());
        student.setSex(reader.nextLine());
        student.setStuID(reader.nextLong());
        student.setAge(reader.nextInt());
        list.add(student);
        printall();
    }
}
